package com.zimin.cloud.system.controller;

import com.zimin.cloud.mine.pojo.system.business.LoginBO;
import com.zimin.cloud.system.biz.IAccountBiz;
import com.zimin.cloud.system.controller.api.ILoginController;
import com.zimin.shared.enums.ResponseStatusEnum;
import com.zimin.shared.pojo.BaseController;
import com.zimin.shared.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户信息 前端控制器
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:04
 */
@RestController
public class LoginController extends BaseController implements ILoginController {

    @Autowired
    private IAccountBiz accountBiz;

    @Override
    public Result login(@Validated LoginBO loginBO) {
        return result(accountBiz.login(loginBO), ResponseStatusEnum.LOGIN_SUCCESS);
    }

    @Override
    public Result faceLogin(LoginBO loginBO) throws Exception {
        return result(accountBiz.faceLogin(loginBO), ResponseStatusEnum.FACE_LOGIN_SUCCESS);
    }

    @Override
    public Result getLoginInfoById(String userId, String token) {
        return result(accountBiz.getLoginInfoById(userId, token));
    }
}
